01 / 05

Describe the strict mode in react.

<StrictMode> lets you find common bugs in your components early during development process. Although the Strict Mode checks only run in development, they help you find bugs that already exist in your code but can be tricky to reliably reproduce in production. Strict Mode lets you fix bugs before your users report them.

javascript
Difficulty: 5/10
Topics: unsafe lifecycles, legacy API warnings, development‑only checks

Scenario Questions

0-2 years experience
  1. 1

    If you wrap your component tree with <React.StrictMode>, what will you notice when you run the app in development?

  2. 2

    How would you use StrictMode to catch deprecated lifecycle methods while building a new feature?

  3. 3

    What happens to a useEffect callback when StrictMode is enabled in development?

2-5 years experience
  1. 1

    You added StrictMode to a page and now a component’s useEffect runs twice, causing duplicate API calls. How would you fix the issue without removing StrictMode?

  2. 2

    During a code review a teammate points out that StrictMode is flagging a legacy context API usage. Explain why this warning appears and how you would resolve it.

5-8 years experience
  1. 1

    Our large application is being migrated to StrictMode across multiple teams. What strategy would you propose to roll it out while minimizing runtime regressions?

  2. 2

    Explain the trade‑offs of keeping StrictMode enabled in production builds versus limiting it to development, especially regarding performance and debugging.

  3. 3

    How would you adapt a third‑party library that isn’t compatible with StrictMode’s double‑render checks without forking it?

8+ years experience
  1. 1

    As a staff engineer, you need to convince leadership to adopt React.StrictMode across the entire codebase. What metrics and arguments would you present to justify the investment?

  2. 2

    Design a migration plan for a monorepo with hundreds of packages, some depending on older React versions, to adopt StrictMode and modern APIs while ensuring backward compatibility.

  3. 3

    How would you set up CI tooling to enforce that new code does not introduce patterns that StrictMode would warn about, and how would you handle existing warnings?

Follow-up Questions

  • Can you share a specific warning you’ve encountered because of StrictMode?
  • Why does StrictMode not affect the production bundle?
  • How would you complement StrictMode with linting rules?